package com.yzqp.servergoods.controller;

import com.yzqp.servergoods.server.GoodsServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GoodsController {
    int i = 0;

    @Autowired
    private GoodsServer goodsServer;

    @GetMapping("updateStock")
    public String updateStock(@RequestParam(value = "count") Integer count, @RequestParam(value = "id") Integer id){
        this.i ++;
        System.out.println("第 " + i + " 次请求............");
        String s = goodsServer.updateStock(id, count);
        return s;
    }
}
